 ///
 /// @file    computer.cc
 /// @author  lemon(haohb13@gmail.com)
 /// @date    2016-02-25 19:05:13
 ///
 
#include <string.h>
#include <iostream>

using std::cout;
using std::endl;

class Computer
{
public://对外提供接口
	void setBrand(char * brand);
	void setPrice(float fprice);
	void print();
private:
	char _brand[20];
	float _fprice;
};


//类之外实现成员函数
void Computer::setBrand(char * brand)
{
	strcpy(_brand, brand);
}
void Computer::setPrice(float fprice)
{
	_fprice = fprice;
}

void Computer::print()
{
	cout << "品牌：" << _brand << endl;
	cout << "价格: " << _fprice << endl;
}


int main(void)
{
	int a;
	Computer pc1;//类的实例化
	//pc1._fprice = 10;//信息隐藏
	pc1.setPrice(5000);
	pc1.setBrand("Thinkpad");
	pc1.print();

	return 0;
}
